home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / dev / lang / SmallEiffel.lha / SmallEiffel / lib_se / call_prefix_minus.e < prev    next >
Text File  |  1998-12-22  |  3KB  |  112 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  4. --                       http://www.loria.fr/SmallEiffel
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it 
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later 
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License 
  11. -- for  more  details.  You  should  have  received a copy of the GNU General 
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class CALL_PREFIX_MINUS
  17.    --   
  18.    --   Prefix operator : "-".
  19.    --   
  20.  
  21. inherit CALL_PREFIX redefine compile_to_c end;
  22.    
  23. creation make, with
  24.    
  25. feature 
  26.    
  27.    precedence: INTEGER is 11;
  28.    
  29. feature {NONE}
  30.    
  31.    make(operator_position: POSITION; rp: like target) is
  32.       require
  33.      operator_position /= Void;
  34.      rp /= Void
  35.       do
  36.      !!feature_name.make(operator,operator_position);
  37.      target := rp;
  38.       ensure
  39.      start_position = operator_position;
  40.      target = rp
  41.       end;
  42.  
  43. feature
  44.  
  45.    operator: STRING is
  46.       do
  47.      Result := us_minus;
  48.       end;
  49.    
  50.    isa_dca_inline_argument: INTEGER is
  51.       do
  52.      if result_type.is_integer then
  53.         Result := target.isa_dca_inline_argument;
  54.      end;
  55.       end;
  56.  
  57.    dca_inline_argument(formal_arg_type: TYPE) is
  58.       do
  59.      cpp.put_character('-');
  60.      cpp.put_character('(');
  61.      target.dca_inline_argument(formal_arg_type)
  62.      cpp.put_character(')');
  63.       end;
  64.  
  65.    is_static: BOOLEAN is
  66.       do
  67.      if target.result_type.is_integer then
  68.         if target.is_static then
  69.            Result := true;
  70.         end;
  71.      end;
  72.       end;
  73.  
  74.    static_value: INTEGER is
  75.       do
  76.      if target.result_type.is_integer then
  77.         if target.is_static then
  78.            Result := - target.static_value;
  79.         end;
  80.      end;
  81.       end;
  82.  
  83.    compile_to_c is
  84.       do
  85.      if run_control.boost and then
  86.         run_feature.current_type.is_basic_eiffel_expanded then
  87.         cpp.put_character('-');
  88.         cpp.put_character('(');
  89.         target.compile_to_c;
  90.         cpp.put_character(')');
  91.      else
  92.         call_proc_call_c2c;
  93.      end;
  94.       end;
  95.    
  96.    compile_to_jvm is
  97.       do
  98.      call_proc_call_c2jvm;
  99.       end;
  100.    
  101.    jvm_branch_if_false: INTEGER is
  102.       do
  103.      Result := jvm_standard_branch_if_false;
  104.       end;
  105.  
  106.    jvm_branch_if_true: INTEGER is
  107.       do
  108.      Result := jvm_standard_branch_if_true;
  109.       end;
  110.    
  111. end -- CALL_PREFIX_MINUS
  112.